#! /usr/bin/env python
#coding=utf-8

from django.shortcuts import render_to_response
from django.template import RequestContext
#from apps.activity.models import Activity
from django.contrib.auth.models import User
#from apps.mainpage.models import Mainpage
#from apps.mainpage.myfilter import cut
import datetime
from django.http import HttpResponseRedirect

def home(request):

#    today = datetime.date.today
#    activitylisthot = Activity.objects.order_by('-attentioncount').filter(endtime__gte=today)[0:3]
#    #recentlist = Activity.objects.order_by('-createdtime').order_by('attentioncount')[0:3]
#    recentlist = Activity.objects.none()
#    if request.user.is_authenticated() :
#        hotlist = [activity.id for activity in activitylisthot]
#        newslist = News.objects.select_related('master', 'author').exclude(object_id__in=hotlist)
#        flist = [i.b for i in request.user.aset.all()]
#        newslist = newslist.order_by('-createdtime').filter(author__username__in = flist)[0:10]
#
#        distinctnewslist = []
#        idlist = []
#        for news in newslist:
#            if news.object_id not in idlist:
#                distinctnewslist.append(news)
#                idlist.append(news.object_id)
#        newslist = distinctnewslist
#    else:
#        newslist = News.objects.none()
#    
#    headline = Mainpage.objects.get(page='mainpage')
    return render_to_response('home.html',{
#        'activitylisthot': activitylisthot,
#        'newslist': newslist,
#        'headline': headline,
#        'recentlist': recentlist
        }, context_instance=RequestContext(request))
